﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace bdnt_pets_system_Entity
{
    [DataContract]
    public class Tbl_DictInfo : INotifyPropertyChanged
    {
        Int32 id;
        [DataMember]
        public Int32 Id
        {
            get { return id; }
            set { id = value; }
        }
        string pName;
        [DataMember]
        public string PName
        {
            get { return pName; }
            set { pName = value; }
        }

        string dictName;
        [DataMember]
        [Required(ErrorMessage = "字典名称不能为空！")]
        public string DictName
        {
            get { return dictName; }
            set
            {
                if (dictName != value)
                {
                    Validator.ValidateProperty(value,
                        new ValidationContext(this, null, null) { MemberName = "DictName" });
                    dictName = value;
                    this.OnPropertyChanged("DictName");
                }
            }
        }

        string en_dictName;
        [DataMember]
        [Required(ErrorMessage = "英文字典名称不能为空！")]
        public string en_DictName
        {
            get { return en_dictName; }
            set
            {
                if (en_dictName != value)
                {
                    Validator.ValidateProperty(value,
                        new ValidationContext(this, null, null) { MemberName = "en_DictName" });
                    en_dictName = value;
                    this.OnPropertyChanged("en_DictName");
                }
            }
        }

        string dictValue;
        [DataMember]
        [Required(ErrorMessage = "字典植不能为空！")]
        public string DictValue
        {
            get { return dictValue; }
            set
            {
                if (dictValue != value)
                {
                    Validator.ValidateProperty(value,
                        new ValidationContext(this, null, null) { MemberName = "DictValue" });
                    dictValue = value;
                    this.OnPropertyChanged("DictValue");
                }
            }
        }

        Int32 pId;
        [DataMember]
        public Int32 PId
        {
            get { return pId; }
            set { pId = value; }
        }

        Int32 dictType;
        [DataMember]
        public Int32 DictType
        {
            get { return dictType; }
            set { dictType = value; }
        }

        string remark;
        [DataMember]
        public string Remark
        {
            get { return remark; }
            set { remark = value; }
        }

        Int32 sequence;
        [DataMember]
        [Range(0, 999999, ErrorMessage = "排序为0~999999之间的数字！")]
        public Int32 Sequence
        {
            get { return sequence; }
            set
            {
                if (sequence != value)
                {
                    Validator.ValidateProperty(value,
                        new ValidationContext(this, null, null) { MemberName = "Sequence" });
                    sequence = value;
                    this.OnPropertyChanged("Sequence");
                }
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        private void OnPropertyChanged(string PropName)
        {
            if (PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(PropName));
            }
        }
    }
}
